<?php

return array(
    // 校验工具类规则初始化
    'VALIDATE_UTIL_CUSTOM_RULE' => array(
        // 修改错误提示
        'password' => array(NULL, NULL, '403,213,error'),
        'username' => array(NULL, NULL, '403,215,error'),
        'mobile' => array(NULL, NULL, '403,130,error'),
        'email' => array(NULL, NULL, '403,141,error'),
        'notempty' => array(NULL, NULL, '403,214,error'),
        'notnull' => array(NULL, NULL, '403,212,error'),
        'IDCard' => array('callback', 'validateIdCard', '403,208,error'),
        'natureNumber' => array(NULL, NULL, '403,213,error'),
        'integer' => array(NULL, NULL, '403,213,error'),
        'booleanInt' => array(NULL, NULL, '403,213,error'),
        'positiveInteger' => array(NULL, NULL, '403,213,error'),
        'moreNow' => array(NULL, NULL, '403,3391,error'),
        // 增加校验规则
        'vcode' => array('regex', '/^[a-zA-Z0-9]{4}$/', '403,121,error'),
        'vcode6' => array('regex', '/^\d{6}$/', '403,121,error'),
        'randomNumber' => array('regex', '/^\d{6}$/', '403,213,error'),
        'md5password' => array('regex', '/^[a-zA-Z0-9]{32}$/', '403,213,error'),
        // 增加时间格式校验规则
        'isHour_G' => array('regex', '/^\d|1\d|2[0-4]$/', '403,213,error'),
        'isHourMinute' => array('regex', '/^([0-1]{1}\d|2[0-3]):([0-5]\d)$/', '403,213,error'),
        'isDateTime' => array('function', array('checkTimeStrFormat', 'Y-m-d H:i:s'), '403,213,error'),
        'isDateTimeWithoutSecond' => array('function', array('checkTimeStrFormat', 'Y-m-d H:i'), '403,213,error'),
        'isDate' => array('function', array('checkTimeStrFormat', 'Y-m-d'), '403,213,error'),
        'timeformat_H:i' => array('function', array('checkTimeStrFormat', 'H:i'), '403,213,error'),
        'timeformat_Y-m-d H:i' => array('function', array('checkTimeStrFormat', 'Y-m-d H:i'), '403,213,error'),
        // ID检验
        'id' => array('regex', "/^\d{1,10}$/", '403,213,error'),
        'concatId' => array('regex', '/^(\d+,)*(\d+)$/', '403,213,error'),
        // 客栈相关校验
        'nameLength20' => array('mblength', '0,20,utf-8', '403,213,error'),
        'nameLength50' => array('mblength', '0,50,utf-8', '403,213,error'),
        'nameLength60' => array('mblength', '0,60,utf-8', '403,217,error'),
        'nameLength100' => array('mblength', '0,100,utf-8', '403,213,error'),
        'nameLength15' => array('mblength', '0,15,utf-8', '403,213,error'),
        'nameLength500' => array('mblength', '0,500,utf-8', '403,217,error'),
        'nameLength255' => array('mblength', '0,255,utf-8', '403,213,error'),
        'communityNumber' => array('regex', '/^\d{10}$/', '403,213,error'),
        // 价格校验
        'decimal8_2' => array('regex', '/^(-)?(\d{1,6})((\.\d{1,2})?)$/', '403,213,error'),
        'charityDecimal8_2' => array('regex', '/^[1-9]([0-9]{0,5})(\.[\d]{1,2})?$/', '403,213,error'),
        'decimal9_6' => array('regex', '/^(\d{1,3})((\.\d{1,6})?)$/', '403,213,error'),
        'decimal4_2' => array('regex', '/^(\d{1,2})(\.[0-9]{1,2})?$/', '403,213,error'),
        'gtZero' => array('function','isGtZero', '403,213,error'),
        // 房间相关校验
        'roomDirty' => array('in', 'clean,dirty', '403,213,error'),
        // 订单相关校验
        'orderPayType' => array('in', 'rec,dep', '403,213,error'),
        'refundStatus' => array('in', implode(',', array(ORDER_REFUND_NOT_APPLY, ORDER_REFUND_APPLY, ORDER_REFUND_SUCCESS, ORDER_REFUND_REFUSE)), '403,213,error'),
        'orderRemark' => array('mblength', '0,255,utf-8', '403,213,error'),
        'sessionId' => array('regex', '/^[-,a-zA-Z0-9]{1,128}$/', '403,213,error'),

        'areaCode' => array('function', 'checkAreaCode', '403,216,error'),
        'orderTimeout' => array('function', 'checkNumberBetween,1,1440', '403,213,error'),
        // 16位到20位的银行卡号
        'bankNumber' => array('regex', '/^\d{16,20}$/', '403,213,error'),
        'bookHour' => array('regex', '/^[246]$/', '403,213,error'),
        'bookMonth' => array('regex', '/^[1-7]$/', '403,213,error'),
        //'bookNight' => array('regex', '/^[0-7]$/', '403,213,error'),
        'bookNight' => array('regex', '/^(\d|([1-2]\d?)|30)$/', '403,213,error'),
        // 域名
        'hostRegex' => array('regex', '/^([a-zA-Z]\w{0,10})\.([a-zA-Z0-9]\w{0,44}[a-zA-Z0-9]\.(com|com\.cn|net|org|info|mobi))|([a-zA-Z0-9]\w{0,44}[a-zA-Z0-9](?!CHINA|CHINESE)\.cn)$/', '403,804,error'),
    )
);
